<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>后台管理系统</title>
    {load href="/static/css/bootstrap.css" /}
    {load href="/static/css/theme.css" /}
    {load href="/static/css/font-awesome.css" /}
    {load href="/static/js/jquery-1.7.2.min.js" /}
    <!-- Demo page code -->
    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
        td[name=tds]{
           position:relative;
           top:5px;
        }
        .pagination li{
            float:left;
            list-style: none;
            margin-left:5px;
        }
        .pagination li a{
            color:red;
            text-decoration: none
        }
        .pagination li.active{
            color:blue;
        }
        .pager li{
            float:left;
            list-style: none;
        }
        ul[class=pagination]{
             margin-left:380px;
        }
        .row-fluid{
            margin-top:20px;
        }
        .coolbg{border:none;border-right:1px solid #ACACAC;border-bottom:1px solid #ACACAC;padding:2px;padding-right:5px;padding-left:5px;background:#CCC url(http://localhost/test/public/static/img/allbtbg2.gif);cursor:pointer;}
        a[class=coolbg]{
          color:black;
        }
         a[class=coolbg]:hover{
          color:red;
        }
    </style>
  </head>
  <body class="">  
  {include file="public:header"}
  {include file="public:left"}
    <div class="content">
    <div class="header">
            {include file="public:calendar"} 
            <h1 class="page-title">展示会员信息</h1>
    </div>     
            <ul class="breadcrumb">
            <li class="active">{:request()->module()}<span class="divider">/</span></li>
            <li class="active">{:request()->action()}</li>
        </ul>
        <div class="container-fluid">
            <div class="row-fluid">
             <table width="98%" border="0" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6" align="center">
               <tbody>

                   <tr>
                       <td height="28" colspan="9" background="http://localhost/test/public/static/img/tbg.gif">
                          <table width="99%" border="0" cellspacing="0" cellpadding="0">
                             <tbody>
                                 <tr>
                                     <td width="29%" style="padding-left: 10px;">
                                         <b>注册会员列表</b>
                                     </td>
                                     <td width="71%" align="right">
                                          <a href="{:url('admin/member/administer')}">所有用户</a>|
                                          <a href="{:url('admin/member/administer',['iffor'=>2])}">被禁言用户</a>|
                                          <a href="{:url('admin/member/administer',['ifrec'=>1])}">被推荐用户</a>                                    
                                     </td>
                                 </tr>     
                             </tbody> 
                          </table> 
                       </td>
                   </tr>
                   <tr bgcolor="#FEFCEF" align="center" heigh="30">
                       <td width="5%">选择</td>
                       <td width="8%">id</td>
                       <td width="11%">登录名</td>
                       <td width="16%">email</td>
                       <td width="15%">性别</td>
                       <td width="8%">会员等级</td>
                       <td width="14%">最后登陆</td>
                       <td>操作</td>
                       <td>启用状态</td>
                   </tr>
                   {if condition='$a==1'}
                   {volist id="v" name="mid" key="i"}
                    <tr bgcolor="#FFFFFF" align="center" heigh="26" onmousemove="javascript:this.bgColor='#FCFDEF';" onmouseout="javascript:this.bgColor='#FFFFFF';">
                       <td width="5%"><input name="mid[]" type="checkbox" id="mid" value={$v} class="np"></td>
                       <td width="8%">{$list++}</td>
                       <td width="11%">{$uname[$i-1]}</td>
                       <td width="16%">{$email[$i-1]}</td>
                       <td width="15%">{$sex[$i-1]==1?'男':'女'}</td>
                       <td width="8%">{$type[$i-1]==0?'普通用户':'会员用户'}</td>
                       <td width="18%">{$lasttime[$i-1]}<br>【{$lastip[$i-1]}】</td>
                        <td><a href="{:url('/admin/member/edit',['mid'=>$v])}">修改</a>|<a href="{:url('/admin/member/delete',['mid'=>$v,'a'=>1])}" onclick="return del()">删除</a></td>
                       <td>
                        <script type="text/javascript">
                          function del(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }
                          }
                        </script>
                        {$status[$i-1]==1?'启用':'禁用'}
                        {if condition='$status[$i-1]==1'}
                            <a href="{:url('admin/member/status',['ifstatus'=>0,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            禁用
                            </a>
                            {else}
                            <a href="{:url('admin/member/status',['ifstatus'=>1,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            启用
                            </a>
                        {/if}      
                       </td>
                   </tr>
                   {/volist}
                   <tr bgcolor="#F9FCEF" >
                        <td colspan="9" align="center">
                          <span>共{$pagenum}页/{$num}条记录</span>
                        </td>
                    </tr>                 
                   <tr bgcolor="#FFFFFF">
                     <td colspan="9" height="39">
                        <a href="javascript:void(0)" class="coolbg" id="checkAll">全选</a>
                        <a href="javascript:void(0)" class="coolbg" id="checkCancel">取消</a>
                        <a href="javascript:void(0)" class="coolbg" id="buttonCancel" onclick="return cancel()">删除</a>
                     </td>
                   </tr>
                 
                   <script type="text/javascript">
                         $("#checkAll").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",true);
                             })
                         })
                          $("#checkCancel").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",false);
                             })
                         })
                          function cancel(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }else{    
                              var obj=$("input[name='mid[]']");
                              arr = [];
                              for (k in obj){
                                   if(obj[k].checked){
                                      arr.push(obj[k].value);
                                   }
                                 } 
                              if(arr==''){
                                alert('删除数据为空');
                              }else{
                                  $.ajax({
                                    type:"post",
                                    data:"id="+arr,
                                    url:"{:url('/admin/member/batch_delete')}",
                                    success:function(res){
                                      if(res.code==1){
                                        alert(res.msg);
                                        location.href="/admin/member/administer";
                                      }else{
                                          alert(res.msg);
                                          location.href="/admin/member/administer";
                                      }
                                    },
                                    error:function(){
                                      alert("ajax执行失败");
                                    }
                                  })                                           
                                }
                              }
                          }                       
                     </script>
                        </tbody>
                        </table> 
                          {$page}
                   {elseif condition='$a==3'}
        
                    {volist id="v" name="mid" key="i"}
                    <tr bgcolor="#FFFFFF" align="center" heigh="26" onmousemove="javascript:this.bgColor='#FCFDEF';" onmouseout="javascript:this.bgColor='#FFFFFF';">
                       <td width="5%"><input name="mid[]" type="checkbox" id="mid" value={$v} class="np"></td>
                       <td width="8%">{$list++}</td>
                       <td width="11%">{$uname[$i-1]}</td>
                       <td width="16%">{$email[$i-1]}</td>
                       <td width="15%">{$sex[$i-1]==1?'男':'女'}</td>
                       <td width="8%">{$type[$i-1]==0?'普通用户':'会员用户'}</td>
                       <td width="18%">{$lasttime[$i-1]}<br>【{$lastip[$i-1]}】</td>
                        <td><a href="{:url('/admin/member/edit',['mid'=>$v])}">修改</a>|<a href="{:url('/admin/member/delete',['mid'=>$v,'a'=>2])}" onclick="return del()">删除</a></td>
                       <td>
                        <script type="text/javascript">
                          function del(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }
                          }
                        </script>
                        {$status[$i-1]==1?'启用':'禁用'}
                        {if condition='$status[$i-1]==1'}
                            <a href="{:url('admin/member/status',['ifstatus'=>0,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            禁用
                            </a>
                            {else}
                            <a href="{:url('admin/member/status',['ifstatus'=>1,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            启用
                            </a>
                        {/if}      
                       </td>
                   </tr>
                   {/volist}
                   <tr bgcolor="#F9FCEF" >
                        <td colspan="9" align="center">
                          <span>共{$pagenum}页/{$num}条记录</span>
                        </td>
                    </tr>                 
                   <tr bgcolor="#FFFFFF">
                     <td colspan="9" height="39">
                        <a href="javascript:void(0)" class="coolbg" id="checkAll">全选</a>
                        <a href="javascript:void(0)" class="coolbg" id="checkCancel">取消</a>
                        <a href="javascript:void(0)" class="coolbg" id="buttonCancel" onclick="return cancel()">删除</a>
                     </td>
                   </tr>
                 
                   <script type="text/javascript">
                         $("#checkAll").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",true);
                             })
                         })
                          $("#checkCancel").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",false);
                             })
                         })
                          function cancel(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }else{    
                              var obj=$("input[name='mid[]']");
                              arr = [];
                              for (k in obj){
                                   if(obj[k].checked){
                                      arr.push(obj[k].value);
                                   }
                                 } 
                              if(arr==''){
                                alert('删除数据为空');
                              }else{
                                  $.ajax({
                                    type:"post",
                                    data:"id="+arr,
                                    url:"{:url('/admin/member/batch_delete')}",
                                    success:function(res){
                                      if(res.code==1){
                                        alert(res.msg);
                                        location.href="/admin/member/administer";
                                      }else{
                                          alert(res.msg);
                                          location.href="/admin/member/administer";
                                      }
                                    },
                                    error:function(){
                                      alert("ajax执行失败");
                                    }
                                  })                                           
                                }
                              }
                          }                       
                     </script>
                        </tbody>
                        </table> 
                   {elseif condition='$a==5'}
                        {volist id="v" name="mid" key="i"}
                    <tr bgcolor="#FFFFFF" align="center" heigh="26" onmousemove="javascript:this.bgColor='#FCFDEF';" onmouseout="javascript:this.bgColor='#FFFFFF';">
                       <td width="5%"><input name="mid[]" type="checkbox" id="mid" value={$v} class="np"></td>
                       <td width="8%">{$list++}</td>
                       <td width="11%">{$uname[$i-1]}</td>
                       <td width="16%">{$email[$i-1]}</td>
                       <td width="15%">{$sex[$i-1]==1?'男':'女'}</td>
                       <td width="8%">{$type[$i-1]==0?'普通用户':'会员用户'}</td>
                       <td width="18%">{$lasttime[$i-1]}<br>【{$lastip[$i-1]}】</td>
                        <td><a href="{:url('/admin/member/edit',['mid'=>$v])}">修改</a>|<a href="{:url('/admin/member/delete',['mid'=>$v,'a'=>3])}" onclick="return del()">删除</a></td>
                       <td>
                        <script type="text/javascript">
                          function del(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }
                          }
                        </script>
                        {$status[$i-1]==1?'启用':'禁用'}
                        {if condition='$status[$i-1]==1'}
                            <a href="{:url('admin/member/status',['ifstatus'=>0,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            禁用
                            </a>
                            {else}
                            <a href="{:url('admin/member/status',['ifstatus'=>1,'id'=>$mid[$i-1]])}" class="btn btn-primary">
                            启用
                            </a>
                        {/if}      
                       </td>
                   </tr>
                   {/volist}
                   <tr bgcolor="#F9FCEF" >
                        <td colspan="9" align="center">
                          <span>共{$pagenum}页/{$num}条记录</span>
                        </td>
                    </tr>                 
                   <tr bgcolor="#FFFFFF">
                     <td colspan="9" height="39">
                        <a href="javascript:void(0)" class="coolbg" id="checkAll">全选</a>
                        <a href="javascript:void(0)" class="coolbg" id="checkCancel">取消</a>
                        <a href="javascript:void(0)" class="coolbg" id="buttonCancel" onclick="return cancel()">删除</a>
                     </td>
                   </tr>
                 
                   <script type="text/javascript">
                         $("#checkAll").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",true);
                             })
                         })
                          $("#checkCancel").click(function(){
                             $("input[name='mid[]']").each(function(){
                                $(this).attr("checked",false);
                             })
                         })
                          function cancel(){
                            if(!confirm("确认要删除?")){
                               return false;
                            }else{    
                              var obj=$("input[name='mid[]']");
                              arr = [];
                              for (k in obj){
                                   if(obj[k].checked){
                                      arr.push(obj[k].value);
                                   }
                                 } 
                              if(arr==''){
                                alert('删除数据为空');
                              }else{
                                  $.ajax({
                                    type:"post",
                                    data:"id="+arr,
                                    url:"{:url('/admin/member/batch_delete')}",
                                    success:function(res){
                                      if(res.code==1){
                                        alert(res.msg);
                                        location.href="/admin/member/administer";
                                      }else{
                                          alert(res.msg);
                                          location.href="/admin/member/administer";
                                      }
                                    },
                                    error:function(){
                                      alert("ajax执行失败");
                                    }
                                  })                                           
                                }
                              }
                          }                       
                     </script>
                        </tbody>
                        </table> 
                   {else}
                        <tr bgcolor="#F9FCEF" >
                        <td colspan="9" align="center">
                          <span>共0页/0条记录</span>
                        </td>
                    </tr>
                         </tbody>
                      </table> 
                   {/if}    
                 {include file='public:footer'}
            </div>
        </div>
    </div>
    {load href="/static/js/bootstrap.js" /}
    {load href="/static/js/mymyjs.js" /}
    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
    </script>  
  </body>
</html>


